package com.cnbot.toolkit.context;

import android.content.Context;
/**
 *  @项目名：  EcologyRobot4
 *  @包名：    com.cnbot.ecologyrobot2.base
 *  @文件名:   IRelease
 *  @创建者:   ww
 *  @创建时间:  2019/1/18 11:32
 *  @描述：    application上下文获取
 */
public class AppContextUtil {
    private static Context sContext;

    private AppContextUtil() {

    }

    /**
     * apply it in application
     * @param context
     */
    public static void init(Context context) {
        sContext = context;
    }

    public static Context getApplicationContext() {
        if (sContext == null) {
            throw new NullPointerException("the context is null,please init AppContextUtil in Application first.");
        }
        return sContext;
    }
}
